<!--
	作者：956911785@qq.com
	时间：2019年11月16日23:11:34
	描述：诗词语音-修改
-->

<template>
	<Tcontent ref="Tcontent" :teas="editparam" :title="title" @addsave="editsave"></Tcontent>
</template>

<script>
	import Tcontent from "./Tcontent";
	export default {
		name:"editscyy",
		props: {
    		editparam:{
    			type:Object,	
    			default: function() {
					return null
				}
    		}
    	
    	},
		data() {
			return {
				title:'修改诗词语音'
			}
		},
		components: {
			Tcontent
		},
		methods: {
			editsave:function(datas){	
				const da={...datas};
				var readid=this.editparam.readid;
				var bstate=this.editparam.BSTATE;
				if(bstate=="0"){
					this.$Modal.confirm({
					    title: '提示',
					    content: '是否发布，如果发布请点击确认',
					    onOk: () => {
					        bstate="1";
							const params={
								readid:readid,
								pname:da.pname, 
								author:da.author, 
								nj:da.nj, 
								bj:da.bj, 
								pcontent:da.pcontent, 
								fm:da.fm, 
								listsc:JSON.stringify(da.listsc),//诗词内容
								listyy:JSON.stringify(da.listyy),//诗词相关语音
								bstate:bstate,
							};
							this.edit_scyy(params);
					    },
						onCancel: () => {
							const params={
								readid:readid,
								pname:da.pname, 
								author:da.author, 
								nj:da.nj, 
								bj:da.bj, 
								pcontent:da.pcontent, 
								fm:da.fm, 
								listsc:JSON.stringify(da.listsc),//诗词内容
								listyy:JSON.stringify(da.listyy),//诗词相关语音
								bstate:bstate,
							};
							this.edit_scyy(params);
						}
					});
				}else{
					const params={
						readid:readid,
						pname:da.pname, 
						author:da.author, 
						nj:da.nj, 
						bj:da.bj, 
						pcontent:da.pcontent, 
						fm:da.fm, 
						listsc:JSON.stringify(da.listsc),//诗词内容
						listyy:JSON.stringify(da.listyy),//诗词相关语音
						bstate:bstate,
					};
					this.edit_scyy(params);
				}
				
	        },
			
			
			edit_scyy(params){
				this.$http.post("/host/readbook/scyy/edit_scyy.html",params)
				.then(result => {
					if(result){
						this.$Modal.success({
				            title: "提示",
				            content: "修改成功！"
				       });
				       this.$emit("reload");
				       this.$refs.Tcontent.modal0=false;
					}else{
						this.$Modal.error({
				            title: "提示",
				            content: "修改失败，请联系管理员！"
				        });	
					}
				});
			},
			
			openmodal(){
				this.$refs.Tcontent.modal0 = true;
			}
		},
		mounted() {

		},
		watch:{
			
		},
		computed: {
			
		}
		
	}
</script>

<style scoped="scoped">
	
</style>



